package com.acxy.cms.entity;


import com.acxy.ants.common.kit.DateKit;
import com.acxy.ants.core.plugin.entity.Column;
import com.acxy.ants.core.plugin.entity.Id;
import com.acxy.ants.core.plugin.entity.Model;
import com.acxy.ants.core.plugin.entity.Table;
import com.acxy.ants.resful.annotation.Entity;
import com.alibaba.fastjson.annotation.JSONField;

import java.io.Serializable;
import java.util.Date;

/**
* 文章(article)
*
* @author MrShun
* @version 1.0.0 2017-09-18
*/
@Entity
@Table(name = "article")
public class Article extends Model implements Serializable {

    /** ID */
    @Id
    @Column(name = "id")
    private Long id;

    /**  */
    @Column(name = "cat_id")
    private Long catId;

    /** 标题 */
    @Column(name = "title")
    private String title;

    /** 级别 */
    @Column(name = "level")
    private Integer level;

    /** 颜色 */
    @Column(name = "style")
    private String style;

    /** 标题图 */
    @Column(name = "thumb")
    private String thumb;

    /** 内容 */
    @Column(name = "content")
    private String content;

    /** 简介 */
    @Column(name = "introduce")
    private String introduce;

    /** 关键词 */
    @Column(name = "tags")
    private String tags;

    /** 点击次数 */
    @Column(name = "hits")
    private Integer hits;

    /** 文章作者 */
    @Column(name = "author")
    private String author;

    /** 文章来源 */
    @Column(name = "source")
    private String source;

    /** 来源URL */
    @Column(name = "url")
    private String url;

    /** IP */
    @Column(name = "ip")
    private String ip;

    /** 状态 */
    @Column(name = "status")
    private Integer status;

    /** 创建人 */
    @Column(name = "create_by")
    private String createBy;

    /** 创建时间 */
    @JSONField(format = "yyyy-MM-dd HH:mm")
    @Column(name = "create_time")
    private java.util.Date createTime;

    /** 修改人 */
    @Column(name = "update_by")
    private String updateBy;

    /** 修改时间 */
    @JSONField(format = "yyyy-MM-dd HH:mm")
    @Column(name = "update_time")
    private java.util.Date updateTime;

    //分类名称
    private String catName;

    // 类似微信朋友圈提示
    private String timeTips;

    // 是否是今天发布的文章
    private Boolean day;

	public Article(){}

    public Article(Long id){
        this.id = id;
    }

    public Long getId(){
        return id;
    }

    public void setId(Long id){
        this.id = id;
    }


    public Long getCatId() {
        return catId;
    }

    public void setCatId(Long catId) {
        this.catId = catId;
    }



    public String getTitle(){
        return title;
    }

    public void setTitle(String title){
        this.title = title;
    }


    public Integer getLevel(){
        return level;
    }

    public void setLevel(Integer level){
        this.level = level;
    }


    public String getStyle(){
        return style;
    }

    public void setStyle(String style){
        this.style = style;
    }


    public String getThumb(){
        return thumb;
    }

    public void setThumb(String thumb){
        this.thumb = thumb;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getIntroduce(){
        return introduce;
    }

    public void setIntroduce(String introduce){
        this.introduce = introduce;
    }

    public String getTags() {
        return tags;
    }

    public void setTags(String tags) {
        this.tags = tags;
    }

    public Integer getHits(){
        return hits;
    }

    public void setHits(Integer hits){
        this.hits = hits;
    }


    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getIp(){
        return ip;
    }

    public void setIp(String ip){
        this.ip = ip;
    }


    public Integer getStatus(){
        return status;
    }

    public void setStatus(Integer status){
        this.status = status;
    }


    public String getCreateBy(){
        return createBy;
    }

    public void setCreateBy(String createBy){
        this.createBy = createBy;
    }


    public java.util.Date getCreateTime(){
        return createTime;
    }

    public void setCreateTime(java.util.Date createTime){
        this.createTime = createTime;
    }


    public String getUpdateBy(){
        return updateBy;
    }

    public void setUpdateBy(String updateBy){
        this.updateBy = updateBy;
    }


    public java.util.Date getUpdateTime(){
        return updateTime;
    }

    public void setUpdateTime(java.util.Date updateTime){
        this.updateTime = updateTime;
    }

    public String getCatName() {
        return catName;
    }

    public void setCatName(String catName) {
        this.catName = catName;
    }

    public String getTimeTips() {
        return createTime == null?null:DateKit.toTips(createTime, new Date());
    }

    public void setTimeTips(String timeTips) {
        this.timeTips = timeTips;
    }

    public boolean getDay() {
        if(createTime == null) return false;
        return DateKit.isDay(createTime, new Date());
    }

    public void setDay(boolean day) {
        this.day = day;
    }
}